Repository navigation
Conversation
An image uploaded into a document keeps only its `downloadURL` (`<server>/download/files/<hash>`) in the node's `src`. In a browser-only drive (the default for the hosted distribution and for drives created there), neither the File's commit nor its bytes ever reach a server, so that URL answers 404 and the editor's node view showed "Failed to load image". File previews did not have this problem because they resolve the bytes locally through `useFileObjectUrl`; the editor image never did. - `@tomic/lib`: `blobSubjectFromDownloadUrl` maps a content-addressed download URL back to its `atomic:blob:<hash>`. - `@tomic/react`: `useBlobObjectUrl`, the blob-reference half of `useFileObjectUrl`, for callers without a File resource. - `ImagePicker`: render the local copy when there is one, fall back to the URL otherwise, wait for the lookup instead of racing it, and key the error state by src so a new src gets a fresh attempt. The document still stores the portable URL. - Wrap two label texts in spans: the i18n transform turned them into keyless arrays, which logged a React key warning whenever the picker opened. Adds `document-image.spec.ts`, which fails with "Failed to load image." before this change and passes after, including across a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P648McUYrscNsheXY5Ya81
Polleps
marked this pull request as ready for review
September 29, 2026 13:28
1 of 3 tasks
joepio
added a commit
that referenced
this pull request
Sep 30, 2026
…ent images, onboarding recovery fixes (#1915) Lands #1889 (edit agents, skills and MCP servers in a dialog), #1890 (sidebar account menu in place of the App panel), #1891 (share dialog role select stays open), #1895 (document images from the local blob store) and #1917 (onboarding recovery, metadata request bursts, local bootstrap), tested together on Mancave.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Reported bug: images in documents show "Failed to load image" (regression). No issue number yet.
Root cause
When you upload an image into a document,
Store.uploadFileswrites the File'sdownloadURLas${serverUrl}/download/files/<blake3>. The image node keeps only that URL as itssrc. The bytes stay in the local ClientDb, and the outbox drain pushes them to the server later (maybePushBlobForResource).In a browser-only (local-only) drive, nothing is pushed.
isLocalOnlySubjectskips posting both the commit and the bytes, so no server has the blob, andGET /download/files/<hash>returns 404.MarkdownEditorImage(chunks/RTE/ImagePicker.tsx) passed that URL straight to<img>.onErrorthen fired and set a stickyimageError, which shows "Failed to load image."File previews, glyphs and avatars did not have this problem. They go through
useFileObjectUrl, which serves the local copy as ablob:URL. The document image node never did.This became a regression when browser-only drives turned into the normal path.
openPrivateHomecreates the home drive withlocalOnly: isOriginWithoutNode(...), andDriveTemplateSetupcreates drives withlocalOnly: !!getManagedPortalUrl(). Both arrived in 4a3a0bf ("Batch: storage path simplification…", #1852). That commit is also the root of this repository's imported history, so I can't narrow it down to a single original PR (#1772/#1777/#1779/#1780/#1784/#1782) from here.I ruled out the server side. Against a normal synced drive,
/download/files/<hash>returns 200 withapplication/octet-stream,nosniffandattachment, and Chromium renders the image fine, including after a reload.Fix
@tomic/lib:blobSubjectFromDownloadUrl(url)maps a content-addressed/download/files/<64-hex>URL back toatomic:blob:<hash>. It returnsundefinedfor any other URL, including legacy/download/files/<name>.jpgpaths.@tomic/react:useBlobObjectUrl(blobDid, fallback)is the blob-reference half ofuseFileObjectUrl, which now delegates to it. Its behaviour is unchanged.ImagePicker.tsx:Choose an image <Column/>andTextual Description <TextArea/>into keyless arrays. Wrapping the text in<span>fixes it. The.pochanges are just those two re-keyed messages.Tests
browser/e2e/tests/document-image.spec.ts: creates a browser-only drive and a document, uploads a freshly generated PNG through the slash-command image picker, and asserts the image decodes from ablob:src with no error. It checks this again after a reload. The PNG is generated each run because blobs are content-addressed, and a fixed fixture already on the server would hide the bug.<img>.subject.test.ts: unit tests forblobSubjectFromDownloadUrl.file-upload-offline.spec.ts(covers the refactoreduseFileObjectUrl) andcover-reposition.spec.ts: 4 passed.lintandtypecheckpass for lib, react, data-browser and e2e.browser/libvitest: 1081 passed. data-browser RTE vitest: passed.Checklist
TESTING_COVERAGE.md)No screenshots: the only visible change is that the image renders again where it used to show the error placeholder.
🤖 Generated with Claude Code
https://claude.ai/code/session_01P648McUYrscNsheXY5Ya81
Generated by Claude Code